package com.class04.header6;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassDescription:
 * @JdkVersion: 17
 * @Author: yxy
 * @Created: 2023/12/6 8:59
 */
@RequestMapping("header")
@Controller
//@Service@Repository@Component
public class HeaderController {
    @GetMapping("*")
    @ResponseBody
//    @RequestHeader 批注将请求标头绑定到控制器中的方法参数
    public String getData(@RequestHeader("Host") String host,
                          @RequestHeader("Accept") String accept,
                          @RequestHeader("Connection") String connection

    ){
        System.out.println("host = " + host + ", accept = " + accept + ", connection = " + connection);
        return "host = " + host + ", accept = " + accept + ", connection = " + connection;
    }
}
